﻿<?php
//git 安装目录
$command = '"C:\Program Files\Git\cmd\git" pull 2>$1';
//执行命令
$output = shell_exec($command);
//将错误信息转码
$str = iconv('GBK','UTF-8',$output);
//接收请求信息
$requestBody = file_get_contents("php://input");
if (empty($requestBody)) {
    die('send fail');
}

file_put_contents("git-webhook_log.txt", $requestBody.PHP_EOL, FILE_APPEND);
file_put_contents("git-webhook_log.txt", $str.PHP_EOL, FILE_APPEND);
